def list_normoperate():
    a=[3,4,6,8,2,3,3,2,1,3,3,4,2,1,3]
    b =['eva', 'as','dfdf','你好']
    #升序，sort
    a.sort()
    b.sort()
    print(a)
    print(b)

    #降序，sort(reverse=True)
    a.sort(reverse=True)
    b.sort(reverse=True)
    print(f'降序后a是{a}，b是{b}')

    #逆序.reverse
    a.reverse()
    b.reverse()
    print(f'逆序后a是{a}，b是{b}')

    print("*"*50)
    #for遍历
    for i in a:
        print(f'a的各项分别是{i}',end=' ')
    print('\n')
    for j in b:
        print(f'j的内容是%s'%j ,end=' ')
    print('\n')

    #while遍历
    k=0
    while k <len(a):
        print(a[k],end=' ')
        k+=1

    print('\n')
    print("*"*50)

    #列表简写
    c =a+b
    print(a*2,id(a*2))
    a+=b
    print(a,id(a))
    print(c,id(c))

#list生成式
li= [[col * row for col in range(3)] for row in range(3)]
print(li)
#二维转一维
st=[j for x in li for j in x]
print(st)
#if三元表达式
lsit1 =[x if x%2==0 else x**3 for x in range(1,11)]
print(lsit1)

list2 =[j for i in range(5) for j in range(i)]
print(list2)

list_normoperate()



